function query(pool, sql, callback) {
    return new Promise(function (resolve, reject) {
        pool.getConnection(function (err, connection) {
            if (err) {// not connected!
                console.log('query')
                reject({
                    err: err,
                    msg: '服务器未开启'
                })
            } else {
                // Use the connection
                connection.query(sql, function (error, results, fields) {

                    // Handle error after the release.
                    if (error) reject(error);

                    resolve(results)

                    // When done with the connection, release it.
                    connection.release();

                    // Don't use the connection here, it has been returned to the pool.
                });
            }
        });
    })
}

module.exports = query